package com.eclipse.training.extensions.preferences;

import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import com.eclipse.training.extensions.Activator;

public class PreferenceMainPage extends FieldEditorPreferencePage implements
		IWorkbenchPreferencePage {

	/**
	 * Property page description
	 */
	private static String DESCRIPTION = Messages.PreferenceMainPage_0;

	/**
	 * The properties page id
	 */
	public static String ID = "com.eclipse.training.preferences.PreferenceMainPage"; ////$NON-NLS-1$

	/**
	 * The constructor
	 */
	public PreferenceMainPage() {
		super(GRID);

		/*
		 * Set the preference store and description
		 */
		setPreferenceStore(Activator.getDefault().getPreferenceStore());
		setDescription(DESCRIPTION);
	}

	/**
	 * Creates the field editors. Field editors are abstractions of the common
	 * GUI blocks needed to manipulate various types of preferences. Each field
	 * editor knows how to save and restore itself.
	 */
	public void createFieldEditors() {
		addField(new ColorFieldEditor(IPreferenceConstants.P_COLOR,
				IPreferenceConstants.L_COLOR, getFieldEditorParent()));
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
	 */
	public void init(IWorkbench workbench) {
	}
}
